package com.ruizhong.centercontroll.entity;

import com.ruizhong.centercontroll.service.TCommandService;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class CommandTask implements Runnable {

    private TCommand tCommand;

    private TCommandService tCommandService;

    public CommandTask(TCommand tCommand, TCommandService tCommandService) {
        this.tCommand = tCommand;
        this.tCommandService = tCommandService;
    }


    @Override
    public void run() {
        try {
            tCommandService.executeSingleCommandAndGetReply(tCommand, null,null,null);
            log.info("定时任务"+tCommand.getId()+"执行成功");
        } catch (Exception e) {
            log.info("定时任务异常-"+tCommand.getId());
            e.printStackTrace();
        }
    }
}
